package com.iven.xie.es;

import org.apache.catalina.util.ServerInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.core.env.Environment;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import java.net.InetAddress;

/**
 * @author iven.xie
 * @version 1.0
 * @date 2020/02/28 18:15
 */
@SpringBootApplication
public class Application extends WebMvcConfigurerAdapter {
    private static final Logger logger = LoggerFactory.getLogger(Application.class);

    public static void main(String[] args) throws Throwable {
        SpringApplication app = new SpringApplication(Application.class);
        logger.info("全文搜索服务启动");
        Environment env = app.run(args).getEnvironment();
        logger.info("Server version: {}", ServerInfo.getServerInfo());
        logger.info("Access URLs:\n----------------------------------------------------------\n\t" +
                        "Local: \t\thttp://127.0.0.1:{}\n\t" +
                        "External: \thttp://{}:{}\n----------------------------------------------------------",
                env.getProperty("server.port"),
                InetAddress.getLocalHost().getHostAddress(),
                env.getProperty("server.port"));
        logger.info("java.io.tmpdir={}", System.getProperty("java.io.tmpdir"));
    }
}